<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI简历解析系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background-color: #f8f9fa;
        }
        
        /* 导航栏样式 */
        .navbar {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 0;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
            padding: 15px 0;
            position: relative;
            z-index: 1000;
        }
        
        /* 下拉菜单样式 */
        .dropdown-menu {
            z-index: 1001;
            position: absolute;
            top: 100%;
            left: 0;
            will-change: transform;
            transform: translate3d(0, 0, 0);
        }
        
        .navbar-brand {
            color: #667eea !important;
            font-weight: 700;
            font-size: 1.5rem;
        }
        
        .nav-link {
            color: #555 !important;
            font-weight: 500;
            transition: all 0.3s ease;
            margin-left: 15px;
            font-size: 1rem;
        }
        
        .nav-link:hover {
            color: #667eea !important;
            transform: translateY(-1px);
        }
        
        .nav-link.active {
            color: #667eea !important;
            font-weight: 600;
        }
        
        /* 英雄区域 */
        .hero-section {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 120px 0;
            position: relative;
            overflow: hidden;
        }
        
        .hero-section::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: url('');
            opacity: 0.1;
        }
        
        /* 按钮样式 */
        .btn-primary {
            background: linear-gradient(135deg, #ffffff, #f8f9fa);
            color: #667eea;
            border: none;
            border-radius: 30px;
            padding: 15px 40px;
            font-size: 18px;
            font-weight: 600;
            cursor: pointer !important;
            transition: all 0.3s ease;
            box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
            text-decoration: none;
            pointer-events: auto !important;
            position: relative;
            z-index: 10;
        }
        
        .btn-primary:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 30px rgba(255, 255, 255, 0.3);
            color: #667eea;
        }
        
        .btn-primary:active {
            transform: translateY(-1px);
        }
        
        /* 确保按钮完全可点击 */
        #startParsingBtn {
            display: inline-block;
            position: relative;
            z-index: 100;
            pointer-events: auto !important;
            opacity: 1 !important;
        }
        
        /* 功能卡片样式 */
        .feature-card {
            background: white;
            border-radius: 20px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
            transition: all 0.3s ease;
            border: none;
            padding: 30px;
            height: 100%;
        }
        
        .feature-card:hover {
            transform: translateY(-8px);
            box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
        }
        
        .feature-icon {
            width: 80px;
            height: 80px;
            background: linear-gradient(135deg, #667eea20, #764ba220);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 20px;
            font-size: 2.5rem;
            color: #667eea;
        }
        
        /* 页脚样式 */
        footer {
            background: #333;
            color: white;
            padding: 30px 0;
            text-align: center;
        }
        
        /* 标题样式 */
        h1, h2, h5 {
            font-weight: 700;
        }
        
        h1 {
            font-size: 3.5rem;
            margin-bottom: 20px;
        }
        
        h2 {
            font-size: 2.5rem;
            margin-bottom: 30px;
            color: #333;
        }
        
        h5 {
            font-size: 1.5rem;
            margin-bottom: 15px;
            color: #333;
        }
        
        /* 响应式设计 */
        @media (max-width: 768px) {
            .hero-section {
                padding: 80px 0;
            }
            
            h1 {
                font-size: 2.5rem;
            }
            
            h2 {
                font-size: 2rem;
            }
            
            .btn-primary {
                padding: 12px 30px;
                font-size: 16px;
            }
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg">
        <div class="container">
            <a class="navbar-brand" href="/">AI简历解析系统</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <div class="navbar-nav ms-auto">
                    <a class="nav-link active" href="/">首页</a>
                    <a class="nav-link" href="/resume">简历解析</a>
                    <a class="nav-link" href="/admin" id="adminNavLink" style="display: none;">
                        <i class="fas fa-user-cog text-primary"></i> 管理员
                    </a>
                    <div class="nav-item dropdown" id="userDropdown" style="display: none;">
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown">
                            <span id="usernameDisplay">用户</span>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a class="dropdown-item" href="/resume">简历解析</a></li>
                            <li><a class="dropdown-item" href="/admin" id="adminLink" style="display: none;">管理员面板</a></li>
                            <li><hr class="dropdown-divider"></li>
                            <li><a class="dropdown-item text-danger" href="#" onclick="logout()"><i class="fas fa-sign-out-alt mr-2"></i> 退出登录</a></li>
                        </ul>
                    </div>
                    <a class="nav-link" href="/login" id="loginLink" style="display: none;">
                        <i class="fas fa-sign-in-alt"></i> 登录
                    </a>
                </div>
            </div>
        </div>
    </nav>

    <!-- 主要内容 -->
    <section class="hero-section text-center">
        <div class="container relative-z10">
            <h1 class="mb-4">智能简历解析系统</h1>
            <p class="lead mb-6" style="font-size: 1.25rem; max-width: 800px; margin: 0 auto 30px;">基于AI大模型的智能简历信息提取，快速获取结构化数据，提供简历质量评估和专业建议</p>
            <a href="/resume" class="btn btn-primary" id="startParsingBtn" onclick="window.location.href='/resume'; return true;">开始解析简历</a>
        </div>
    </section>

    <!-- 功能特性 -->
    <section class="py-15" style="padding: 100px 0;">
        <div class="container">
            <h2 class="text-center mb-10">核心功能</h2>
            <div class="row g-5">
                <div class="col-md-4">
                    <div class="feature-card">
                        <div class="feature-icon">
                            <i class="fas fa-file-upload"></i>
                        </div>
                        <h5 class="text-center">多格式支持</h5>
                        <p class="text-center text-gray-600">支持PDF和Word文档格式，自动识别并提取文本内容，无需手动复制粘贴</p>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="feature-card">
                        <div class="feature-icon">
                            <i class="fas fa-brain"></i>
                        </div>
                        <h5 class="text-center">AI智能解析</h5>
                        <p class="text-center text-gray-600">基于大语言模型，智能提取姓名、联系方式、教育经历、工作经验等关键信息</p>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="feature-card">
                        <div class="feature-icon">
                            <i class="fas fa-chart-bar"></i>
                        </div>
                        <h5 class="text-center">结构化输出</h5>
                        <p class="text-center text-gray-600">自动整理信息，生成结构化JSON数据，方便系统集成和数据分析</p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- 页脚 -->
    <footer class="text-center py-6">
        <div class="container">
            <p>&copy; 2025 AI简历解析系统. 保留所有权利</p>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 检查用户登录状态
        function checkLoginStatus() {
            const token = localStorage.getItem('token');
            const username = localStorage.getItem('username');
            const role = localStorage.getItem('role');
            
            // 重置所有导航元素的显示状态
            document.getElementById('userDropdown').style.display = 'none';
            document.getElementById('loginLink').style.display = 'none';
            document.getElementById('adminLink').style.display = 'none';
            document.getElementById('adminNavLink').style.display = 'none';
            
            if (token && username) {
                // 用户已登录
                document.getElementById('usernameDisplay').textContent = username;
                document.getElementById('userDropdown').style.display = 'block';
                
                // 如果是管理员，显示管理员入口
                if (role === 'ADMIN') {
                    document.getElementById('adminLink').style.display = 'block';
                    document.getElementById('adminNavLink').style.display = 'block';
                }
            } else {
                // 用户未登录
                document.getElementById('loginLink').style.display = 'block';
            }
        }

        // 退出登录
        function logout() {
            localStorage.removeItem('token');
            localStorage.removeItem('username');
            localStorage.removeItem('role');
            window.location.href = '/login';
        }

        // 页面加载时检查登录状态
        document.addEventListener('DOMContentLoaded', function() {
            checkLoginStatus();
            
            // 添加按钮点击事件监听
            const startParsingBtn = document.getElementById('startParsingBtn');
            if (startParsingBtn) {
                // 确保按钮可点击
                startParsingBtn.style.pointerEvents = 'auto';
                startParsingBtn.style.opacity = '1';
                startParsingBtn.style.position = 'relative';
                startParsingBtn.style.zIndex = '100';
                startParsingBtn.style.display = 'inline-block';
                
                console.log('开始解析按钮已找到并设置为可点击');
                console.log('当前用户登录状态:', localStorage.getItem('token') ? '已登录' : '未登录');
                console.log('当前用户角色:', localStorage.getItem('role'));
                
                // 添加点击事件处理程序
                startParsingBtn.addEventListener('click', function(e) {
                    console.log('开始解析按钮被点击');
                    console.log('当前用户角色:', localStorage.getItem('role'));
                    console.log('重定向到:', this.href);
                    // 不阻止默认行为，让链接正常工作
                });
            } else {
                console.error('未找到开始解析按钮');
            }
        });
    </script>
</body>
</html>
